package com.ysx.oa.clazz.service.serviceImpl;

import com.ysx.oa.clazz.bean.ClazzStudentTeacherBean;
import com.ysx.oa.clazz.dao.ClazzStudentTeacherDao;
import com.ysx.oa.clazz.entity.ClazzStudentTeacherEntity;
import com.ysx.oa.clazz.service.ClazzStudentTeacherService;
import com.ysx.oa.role.bean.RoleBean;
import com.ysx.oa.role.dao.UserRoleDao;
import com.ysx.oa.user.bean.UserBean;
import com.ysx.oa.user.dao.UserDao;
import com.ysx.oa.utils.GetDateTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 李伟伟
 * @date 2021/11/23 15:48
 */
@Service
public class ClazzStudentTeacherImpl   implements ClazzStudentTeacherService{


    @Autowired
    private ClazzStudentTeacherDao clazzStudentTeacherDao;

    @Autowired
    private UserDao userDao;

    @Autowired
    private UserRoleDao userRoleDao;



    @Override
    public Integer addTeacher(ClazzStudentTeacherBean clazzStudentTeacherBean) {
        clazzStudentTeacherBean.setType(0);
        return clazzStudentTeacherDao.insert(clazzStudentTeacherBean);
    }

    @Override
    public Integer addStudent(ClazzStudentTeacherBean clazzStudentTeacherBean) {
        clazzStudentTeacherBean.setType(1);
        return clazzStudentTeacherDao.insert(clazzStudentTeacherBean);
    }

    @Override
    public List<UserBean> findStudentOrTeacherByNotClass(RoleBean roleBean) {

        return userDao.findStudentOrTeacherByNotClass(roleBean);
    }

    public List<UserBean> findStudentByRoleId(RoleBean roleBean) {
        return userDao.findStudentOrTeacherByNotClass(roleBean);
    }


    public List<ClazzStudentTeacherEntity> findAll() {
        return clazzStudentTeacherDao.findAll();

    }

    public Integer deleteStudent( List<Integer> userId) {
        return clazzStudentTeacherDao.deleteStudent(userId);
    }

}
